//引入重定向
import { Navigate } from 'react-router-dom';
//懒加载，suspense防止跳转页面闪屏
import { lazy, Suspense } from 'react';
import Index from '../view';
import Equities from '../view/Index/Equities';
import Growrole from '../view/Index/Equities/Growrole';
import Scorerole from '../view/Index/Equities/Scorerole';
import VipEquities from '../view/Index/Equities/VipEquities';
import Vipdetail from '../view/Index/Equities/Vipdetail'
import Home from '../view/Index/Home';
import Nowdate from "../view/Index/Home/Nowdate"
import Order from '../view/Index/Order';
import Dealthink from '../view/Index/Order/Dealthink';
import Ordersearch from '../view/Index/Order/Ordersearch';
import Sale from '../view/Index/Sale';
import Cheapcard from '../view/Index/Sale/Cheapcard';
import Flowthink from '../view/Index/Sale/Flowthink';
import Fullcard from '../view/Index/Sale/Fullcard';
import Time from '../view/Index/Sale/Time';
import Set from '../view/Index/Set';
import Personmassage from '../view/Index/Set/Personmassage';
import Shopmassage from '../view/Index/Set/Shopmassage';
import Vipmanage from '../view/Index/Vipmanage';
import Vipcard from '../view/Index/Vipmanage/Vipcard';
import Vipgrade from '../view/Index/Vipmanage/Vipgrade';
import Vipsearch from '../view/Index/Vipmanage/Vipsearch';
import Vipthink from '../view/Index/Vipmanage/Vipthink';
import Vipdetails from '../view/Index/Vipmanage/Vipdetails'


import NotFound from '../view/NotFound';
import Detail from '../view/Index/Sale/Detail'
// 登录
let Login = lazy(() => import('../view/login/Login'));
let Register = lazy(() => import('../view/login/Register'));
const routes = [
    {
        path: '/index',
        element: <Index />,
        children: [
            {
                path: "/index/home",
                element: <Home />,
                children: [
                    {
                        path: "/index/home/nowdate",
                        element: <Nowdate />
                    },
                    {
                        path: '/index/home',
                        element: <Navigate to='/index/home/nowdate' />
                    },
                    {
                        path: '*',
                        element: <NotFound />
                    }
                ]
            },
            {
                path: "/index/equities",
                element: <Equities />,
                children: [
                    {
                        path: "/index/equities/growrole",
                        element: <Growrole />,
                    },
                    {
                        path: "/index/equities/scorerole",
                        element: <Scorerole />,
                    },
                    {
                        path: "/index/equities/vipequities",
                        element: <VipEquities />,
                    },
                    {
                        path: "/index/equities/vipdetail",
                        element: <Vipdetail />
                    },
                    {
                        path: '/index/equities',
                        element: <Navigate to='/index/equities/vipequities' />
                    },
                    {
                        path: '*',
                        element: <NotFound />
                    }
                ]
            },
            {
                path: "/index/order",
                element: <Order />,
                children: [
                    {
                        path: "/index/order/dealthink",
                        element: <Dealthink />,
                    },
                    {
                        path: "/index/order/ordersearch",
                        element: <Ordersearch />,
                    },
                    {
                        path: '/index/order',
                        element: <Navigate to='/index/order/ordersearch' />
                    },
                    {
                        path: '*',
                        element: <NotFound />
                    }
                ]
            },
            {
                path: "/index/sale",
                element: <Sale />,
                children: [
                    {
                        path: "/index/sale/cheapcard",
                        element: <Cheapcard />,
                    },
                    {
                        path: "/index/sale/flowthink",
                        element: <Flowthink />,
                    },
                    {
                        path: "/index/sale/fullcard",
                        element: <Fullcard />,
                    },
                    {
                        path: "/index/sale/time",
                        element: <Time />,
                    },
                    {
                        path: "/index/sale/detail",
                        element: <Detail />,
                    },
                    {
                        path: '/index/sale',
                        element: <Navigate to='/index/sale/cheapcard' />
                    },
                    {
                        path: '*',
                        element: <NotFound />
                    }
                ]
            },
            {
                path: "/index/set",
                element: <Set />,
                children: [
                    {
                        path: "/index/set/personmassage",
                        element: <Personmassage />,
                    },
                    {
                        path: "/index/set/shopmassage",
                        element: <Shopmassage />,
                    },
                    {
                        path: '/index/set',
                        element: <Navigate to='/index/set/shopmassage' />
                    },
                    {
                        path: '*',
                        element: <NotFound />
                    }
                ]
            },
            {
                path: "/index/vipmanage",
                element: <Vipmanage />,
                children: [
                    {
                        path: "/index/vipmanage/vipcard",
                        element: <Vipcard />,
                    },
                    {
                        path: "/index/vipmanage/vipgrade",
                        element: <Vipgrade />,
                    },
                    {
                        path: "/index/vipmanage/vipsearch",
                        element: <Vipsearch />,
                    },
                    {
                        path: "/index/vipmanage/vipthink",
                        element: <Vipthink />,
                    },
                    {
                        path: "/index/vipmanage/vipdetails",
                        element: <Vipdetails />,
                    },
                    {
                        path: '/index/vipmanage',
                        element: <Navigate to='/index/vipmanage/vipsearch' />
                    },
                    {
                        path: '*',
                        element: <NotFound />
                    }
                ]
            },
            {
                path: '/index',
                element: <Navigate to='/index/home' />
            },
            {
                path: '*',
                element: <NotFound />
            }

        ]
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/Register',
        element: <Register />
    },
    {
        path: '/',
        element: <Navigate to='/index' />
    },
    {
        path: '*',
        element: <NotFound />
    }
];

export default routes;